package com.x.erp.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.PriceDao;
import com.x.erp.model.Price;
import com.x.erp.rpc.PriceRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
/**
 * 车辆价格区间服务
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.PriceRpcService", timeout = 60000)
public class PriceService extends BaseService implements PriceRpcService {
	
	@Autowired
	private PriceDao priceDao;// 车辆里程区间信息DAO
	/**
	 * 查询车辆价格区间列表
	 * @param price
	 * @return
	 */
	@Override
	public List<Price> selectPriceList(Price price) {
		try {
			return priceDao.selectPriceList(price);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 根据具体的价格，查询所属的价格区间
	 * @param price
	 * @return
	 */
	@Override
	public Price selectPriceByDetailPrice(Price price) {
		try {
			return priceDao.selectPriceByDetailPrice (price);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
